import { defineStore } from 'pinia';
import app from './app';

const mail = defineStore({
  id: 'mail',
  state: () => ({
    shippingInfo: null, // 寄件
		receivingInfo: null, // 收件
		receivingInfoList: [] ,// 批量收件
		packageInfo: { // 包裹信息
			itemName: '日用品',
			weight: 1,
			packageCount: 1,
			insured: 0,
			vloumLong: 1,
			vloumWidth: 1,
			vloumHeight: 1,
			billRemark: ''
		}
  }),
  getters: {},
  actions: {
    setShippingInfo(info = {}) {
      this.shippingInfo = info
    },
		setReceivingInfo(info = {}) {
		  this.receivingInfo = info
		},
		setReceivingInfoList(info = {}) {
		  this.receivingInfoList.push(info)
		},
		setPackageInfo(info = {}) {
		  this.packageInfo = info
		}
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'mail-store',
      },
    ],
  },
});

export default mail;
